<?php
error_reporting(0);
$isadmin=1;  
include '../../comm/config.php';
include '../../comm/checkpostandget.php';
include '../check.php';
$typename=$_POST['typename']; 
$typecode=$_POST['typecode']; 
$wz=$_POST['wz'];
$sj= date("Y-m-d H:i:s");  

$sql="select * from ".$BIAOTOU."malltype where typecode='".$typecode."'";
$rs = mysql_query($sql);
$num=mysql_num_rows($rs);
if($num!=0){
	echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><script language=javascript>alert('添加失败，该类别代码已经存在！');window.location='mall_type_add.php?id=".$id."';</script>";
}else{
	$q = "insert into ".$BIAOTOU."malltype (typename,typecode,sort) values('".$typename."','".$typecode."','".$wz."')";
	mysql_query($q);
	admin_log('新增商城类别');
}
    
mysql_close();
header('Location: mall_type.php'); 
?>